# -*- coding: utf-8 -*-
import unittest
from welcome_screen import WelcomeScreen
from presenter_mock import PresenterMock
from model.gamestate import *
import mox


class WelcomeTest(unittest.TestCase):
    def setUp(self):
        self.presenter = PresenterMock(Phase.GAME_CONFIG)
        self.gamestate = GameState(None, None, None, None, None, None, None)

    def test_button_press(self):
        widget = WelcomeScreen(self.gamestate, self.presenter)
        widget.start_game()
        self.assertEquals(self.presenter.is_phase_changed, True)

    def threading_test(self):
        from time import sleep
        self.mox.StubOutWithMock(urllib2, 'urlopen')
        urllib2.urlopen(mox.IsA(str))
        self.mox.ReplayAll()
        #widget = WelcomeScreen()
        #sleep(1)
        self.assertEquals(1, 2)
        self.assertEquals(widget.join_button.enabled, True)
        self.assertEquals(widget.load_button.enabled, True)


if __name__ == '__main__':
    unittest.main()
